package ru.mirent.schemegenerator;

public class Interact {
    private Part part1;
    private Part part2;

    public Interact(Part part1, Part part2) {
        this.part1 = part1;
        this.part2 = part2;
    }

    public void show() {
        String params = "";

        for (int i = 0; i < part1.getParams().size(); i++) {
            if (i == 0) {
                params = "(";
            }

            Class clazz = part1.getParams().get(i);
            params += clazz.getSimpleName();

            if (i == part1.getParams().size() - 1) {
                params += ")";
            } else {
                params += ", ";
            }
        }

        if (params.isEmpty()) {
            System.out.println(String.format("\"%s\" -> \"%s\": %s", part1.getClassName(), part2.getClassName(), part1.getMethodName()));
        } else {
            System.out.println(String.format("\"%s\" -> \"%s\": %s\\n%s", part1.getClassName(), part2.getClassName(), part1.getMethodName(), params));
        }
    }
}
